Recent advances in Internet technology have changed the way we exchange information. Ubiquitous use of the Internet has led to the idea of convergence, The different types of data (e.g. video, sounds, pictures and text) must traverse the same network, and this has given rise to a plethora of protocols which aim to transmit real time and data traffic on a single network with quality of service support.
Chief among these protocols are DiffServ, IntServ and MPLS, each of which requires packet classification (i.e. determination of the packet's type) in real time when it is received. Packet classification includes the following steps:                The packet is parsed by a parser device to identify bytes of interest (a data key) within the packet. Let us call the number of bits in this data key N.        The data key is compared with M user-defined rules, each rule having a respective priority level, to identify whether the data key obeys any rule, and if so which is the rule of highest priority which is obeyed.        Depending upon the identified rule, action is taken.        
The present application is directed to the second of these three steps.
Each rule, labelled by an index I, is represented by an N-bit rule vector. The I-th rule may be written as Rule [I][N−1:0], that is a vector having components which are 0 or 1 and in locations in a range 0 to N−1. For each of the rules there is a corresponding “mask”, which is also an N-bit vector of components which are 0 or 1, and is written as Mask [I][N−1:0]. The data key is also an N-bit vector of components which are 0 or 1, and is written as KEY [I][N-1:0]. The data key KEY is said to match Rule [I] if, for each of the bits for which Mask[I] is equal to 1, Rule [I] is equal to the corresponding bit of the data key. This criterion may be expressed as:Rule[I] bitwiseAND Mask [I]=KEY bitwiseAND Mask [I]  (1)where the operation bitwiseAND compares two N-component vectors and gives an N-component vector having components which are 1 when the corresponding components of both the first two vectors are 1, and otherwise 0.
A simple, known method to detect a rule match would be to store the mask bits in one set of registers, and the rule bits in other registers. Using flip-flop circuits, the data key bits are combined with the mask and rule bits to determine a match by directly verifying whether relationship (1) is true. The number of flip-flops required to implement this scheme will be enormous when the number of rules is high.